home *** CD-ROM | disk | FTP | other *** search
/ Unreal Tournament Game Programming for Teens / UnrealTournamentGameProgrammingForTeens.iso / Chapter Files / Chapter10 / UT2004 / Ch09Disco / Classes / DiscoLightTrigger.uc < prev    next >
Encoding:
Text File  |  2006-10-29  |  1.5 KB  |  56 lines

  1. //=============================================================================
  2. // DiscoLightTrigger.
  3. //=============================================================================
  4. class DiscoLightTrigger extends Trigger
  5.     placeable;
  6.  
  7. // # 1
  8. // Called when an actor touches a trigger
  9. function Touch( Actor Other )
  10. {
  11.     // # 2
  12.     // Create local storage for an Actor
  13.     local Actor SomeActor;
  14.     local TriggerLight SomeTriggerLight;
  15.  
  16.     // --
  17.     if ( ReTriggerDelay > 0 )
  18.     {
  19.         if ( Level.TimeSeconds - TriggerTime < ReTriggerDelay )
  20.             return;
  21.         TriggerTime = Level.TimeSeconds;
  22.     }
  23.     // --
  24.  
  25.     // # 3
  26.     // Iterate over all Actors in the level and only care about
  27.     // the ones whose tag is set to the name of this trigger event
  28.     //Find everything that is an actor
  29.     //
  30.     //A dynamic Actor object is one that can change
  31.     //ForEach DynamicActors( class 'Actor', SomeActor, Event)
  32.     //Event is the event that this trigger can process
  33.    // This is set in the Event property of the TriggerLight class
  34.    // This is under Events and is called DiscoLight
  35.     foreach DynamicActors( class 'TriggerLight', SomeTriggerLight, Event){
  36.         // # 4
  37.         // Trigger this actor
  38.         SomeTriggerLight.Trigger(Other, Other.Instigator);
  39.     }
  40.  
  41.     // --
  42.     if (RepeatTriggerTime > 0){
  43.         SetTimer(RepeatTriggerTime, false);
  44.     }
  45.      // --
  46.  
  47.     // # 5
  48.     // Note: we do not call Super.Touch(Other) here because we
  49.     // are handling the trigger event ourself and that's all we
  50.     // want to do
  51. }
  52.  
  53. defaultproperties
  54. {
  55. }
  56.